/**
 * This method formats the supplied date in this format : dd/MM/yyyy
 **/
function toDDmmYYYY(aDate){
	return convert(aDate).toDDmmYYYY();
}

/**
 * This method formats the supplied date in this format : dd/MM/yyyy
 **/
function convert(aDate){
	return {toDDmmYYYY: function() {
		return $.format.date(aDate, "dd/MM/yyyy");
		}
	}
}

/**
 * This method returns an anchor tag which contains the supplied animalId
 **/
function renderAction(animalId){
	return '<a href="detail.html?id=' + animalId + '">Details</a>';
}

/**
 * This method returns a checkbox input tag which is checked if hasHorn is true, and 
 * unchecked if hasHorn is false
 **/
function renderCheckBox(hasHorn){
	
	if(hasHorn){
		return '<input value = 1 type="checkbox" checked disabled/>';
	}else{
		return '<input value = 0 type="checkbox" disabled/>';
	}
}

/**
 * This method set the value of the supplied element with val
 **/
function setValueOf(element){
	return {to: function(value) {
			return element.val(value);
		}
	}
}

/**
 * When the supplied condition is true, then it will checked the supplied checkbox
 **/
function when(aCondition){
	
	return { tickThisCheckbox: function(aCheckbox){
				 if(aCondition){
					aCheckbox.attr('checked', 'checked');
				 }
			}
		}
}


